package com.rhb.af.web.screen.bean;

import java.util.ArrayList;
import java.util.List;

public class Grid {
	private String name;
	private String title;
	private boolean append;
	private boolean edit;
	private boolean remove;
	private String primaryKey;
	//private String form;
	//private String bean;
	private List fields;
	private List behaviors;
	
	
	public Grid(){
		name = "";
		title = "";
		//form = "";
		//bean = "";
		append = true;
		edit = true;
		remove = true;
		primaryKey = "";
		fields = new ArrayList();
		behaviors = new ArrayList();
	}
	
	public Grid(Grid grid){
		name = new String(grid.getName());
		title = new String(grid.getTitle());
		//form = new String(grid.getForm());
		//bean = new String(grid.getBean());
		append = new Boolean(grid.isAppend());
		edit = new Boolean(grid.isEdit());
		remove = new Boolean(grid.isRemove());
		primaryKey = new String(grid.getPrimaryKey());
		fields = new ArrayList();
		for(int i=0; i<grid.getFields().size(); i++){
			fields.add(new Field((Field)grid.getFields().get(i)));
		}
		
		behaviors = new ArrayList();
		for(int i=0; i<grid.getBehaviors().size(); i++){
			behaviors.add(new Behavior((Behavior)grid.getBehaviors().get(i)));
		}		
	}
	
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public List getFields() {
		return fields;
	}
	public void setFields(List fields) {
		this.fields = fields;
	}
	public List getBehaviors() {
		return behaviors;
	}
	public void setBehaviors(List behaviors) {
		this.behaviors = behaviors;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String toString(){
		StringBuffer sb = new StringBuffer();
		sb.append("name=" + name);
		sb.append(",title=" + title);
		for(int i=0; i<fields.size(); i++){
			Field f = (Field)fields.get(i);
			sb.append(",field = " + f.toString());
		}
		for(int i=0; i<behaviors.size(); i++){
			Behavior b = (Behavior)behaviors.get(i);
			sb.append(",behavior = " + b.toString());
		}
		return sb.toString();
	}

	public boolean isAppend() {
		return append;
	}

	public void setAppend(boolean append) {
		this.append = append;
	}

	public boolean isEdit() {
		return edit;
	}

	public void setEdit(boolean edit) {
		this.edit = edit;
	}

	public boolean isRemove() {
		return remove;
	}

	public void setRemove(boolean remove) {
		this.remove = remove;
	}

	public String getPrimaryKey() {
		return primaryKey;
	}

	public void setPrimaryKey(String primaryKey) {
		this.primaryKey = primaryKey;
	}

	
	/*
	public String getForm() {
		return form;
	}

	public void setForm(String form) {
		this.form = form;
	}
	
	
	public String getBean() {
		return bean;
	}

	public void setBean(String bean) {
		this.bean = bean;
	}*/

}
